import type { RouteRecordRaw } from 'vue-router'

/**
 * @FILENAME:  module.ts
 *  @Description:  // 自动获取路由
 * @Author: ellwood
 * @CreateDate: 2024/10/29 - 22:00
 * @Version: V1.0.0
 */
export default function autoloadModelRoutes() {
  const modules: Record<string, any> = import.meta.glob('../module/**/*.ts', {
    eager: true,
  })

  const routes = [] as RouteRecordRaw[]

  Object.keys(modules).forEach((key) => {
    routes.push(modules[key].default)
  })

  return routes
}
